#!/bin/bash
#zhushi:httpd进程restart and if
#www.netcraft.com

test=$(ps aux | grep "httpd" | grep -v "grep")
#截取Httpd进程,并把结果赋予变量test

if [ -n "$test" ];then
#if test 的值不为空，则执行then中的命令
		echo "$(date) httpd is ok!" >> /tmp/autostart-acc.log
		echo "httpd服务正常"
	else
		echo "http服务异常/正在重新启动httpd服务"
		/etc/rc.d/init.d/httpd restart &> /dev/null
		echo "$(date) restart httpd!!" >> /tmp/autostart-err.log
fi
